<template>
    <div class="container">
        <a-button type="primary" :loading="loading" :size="size" @click="handleSubmit">{{ t('yl.search') }}</a-button>
        <a-button :loading="loading" :size="size" @click="handleReset" v-if="!hideReset">{{ t('yl.reset') }}</a-button>
    </div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { useI18n } from 'vue-i18n';

export default defineComponent({
    name: 'search',
    props: {
        loading: {
            type: Boolean,
            default: () => false,
        },
        hideReset: {
            type: Boolean,
            default: () => false,
        },
        size: {
            type: String,
            default: () => 'default',
        },
    },
    setup(props, { emit }) {
        const { t } = useI18n();
        const handleSubmit = () => {
            emit('submit');
        };
        const handleReset = () => {
            emit('reset');
        };
        return {
            t,
            handleSubmit,
            handleReset,
        };
    },
});
</script>
<style lang="scss" scoped>
.container {
    @include flex;
    :deep .ant-btn {
        margin-right: $width20;
        &.ant-btn:last-child {
            margin-right: $width0;
        }
    }
}
</style>
